package com.example.designpattenexample.strategy.example;

public class PurchaseOrder {

    public double getTotalOrderMount(ShoppingCard card){
        double totalCardMount =  card.getNum() * card.getUnitPrice();
        double discountMount = 0;
        if (totalCardMount > 1000) {
            discountMount = new TotalDiscountStategy(card).getDiscountAmount();
        }else{
            discountMount = new UnitDiscountStrategy(card).getDiscountAmount();
        }
        card.setDiscountAmount(discountMount);
        return totalCardMount - discountMount;
    }

}
